package com.ics.top.batch.management.rowmapper;


import com.ics.top.batch.management.domain.BatchUserManagementDTO;
import com.ics.top.service.util.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by Administrator on 2018/4/25.
 */
@Component
public class BatchUserManagementRowMapper implements RowMapper {
    private static final Logger log = LoggerFactory.getLogger(BatchUserManagementRowMapper.class);
    @Override
    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
        BatchUserManagementDTO customerCredit = new BatchUserManagementDTO();
        customerCredit.setId(rs.getLong("id"));
        customerCredit.setBuyerNick(rs.getString("buyer_nick"));
        customerCredit.setStatus("normal");
        customerCredit.setGrade(rs.getLong("grade"));
        customerCredit.setTradeCount(rs.getLong("trade_count"));
        customerCredit.setTradeAmount(rs.getString("trade_amount"));
        customerCredit.setCloseTradeCount(rs.getLong("close_trade_count"));
        customerCredit.setCloseTradeAmount(rs.getString("close_trade_amount"));
        customerCredit.setItemNum(rs.getLong("item_num"));
        customerCredit.setGroupIds(rs.getString("group_ids"));
        customerCredit.setProvince(rs.getString("province"));
        customerCredit.setCity(rs.getString("city"));
        customerCredit.setAvgPrice(rs.getString("avg_price"));
        customerCredit.setRelationSource(rs.getLong("relation_source"));
        customerCredit.setLastTradeTime(DateUtil.getStringConvertDateTime(rs.getString("last_trade_time")));
        customerCredit.setItemCloseCount(rs.getLong("item_close_count"));
        customerCredit.setBizOrderId(rs.getLong("biz_order_id"));
        customerCredit.setGradeName(rs.getString("grade_name"));
        customerCredit.setStoresName(rs.getString("stores_name"));
        customerCredit.setMobile(rs.getString("mobile"));
        customerCredit.setLocale(rs.getString("locale"));
        return customerCredit;
    }


}
